CARGO_BIN = cargo
BIN_OUTPUT = dpm


PROJ_DIR = ./proj
OUTPUT_DIR = ./dist


RET_BIN  = ${PROJ_DIR}/target/release/${BIN_OUTPUT}
RET_STATIC_0 = ${PROJ_DIR}/dpm_setting

INS_BIN = ${OUTPUT_DIR}/${BIN_OUTPUT}
INS_STATIC_0 = ${OUTPUT_DIR}/dpm_setting


INSTALL_PATH = /usr/local/bin

# ===make===
${BIN_OUTPUT}:
	rm -rf ${PROJ_DIR}/target
	rm -rf ${OUTPUT_DIR}

	mkdir ${OUTPUT_DIR}

	cd ${PROJ_DIR} && ${CARGO_BIN} +nightly build --release
	#todo upx upx ${RET_BIN}

	cp ${RET_BIN} ${INS_BIN}
	cp ${RET_STATIC_0} ${INS_STATIC_0}

# ===clean===
clean:
	rm -rf ${PROJ_DIR}/target
	rm -rf ${BUILD_DIR}

# ===install===
install:
	install ${OUTPUT_DIR}/* ${INSTALL_PATH}